//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.util;

import com.mdx.api.autocode.fileread.Api;
import com.mdx.api.autocode.fileread.ApiInfo;
import com.util.Tool;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.swing.JFileChooser;

public class ReadUtil {
    public ReadUtil() {
    }

    public static List<Api> spliceList(List<ApiInfo> list) {
        ArrayList listapi = new ArrayList();
        Iterator var2 = list.iterator();

        while(var2.hasNext()) {
            ApiInfo ai = (ApiInfo)var2.next();
            listapi.addAll(ai.getApis());
        }

        return listapi;
    }

    public static String TraverseMap(Map map) {
        String str = "";
        Set set = map.keySet();

        Object obj;
        for(Iterator it = set.iterator(); it.hasNext(); str = str + obj + "\n" + map.get(obj)) {
            obj = it.next();
        }

        return str;
    }

    public static String findApiId(String str) {
        int index = str.indexOf("(");
        return str.substring(0, index);
    }

    public static List<Api> search(List<Api> listApi, String word) {
        ArrayList list = new ArrayList();
        Iterator var3 = listApi.iterator();

        while(var3.hasNext()) {
            Api api = (Api)var3.next();
            String id = api.getId();
            String remark = api.getRemark();
            if(Tool.myMatch(word, id + remark)) {
                list.add(api);
            }
        }

        return list;
    }

    public static String OpenFile() {
        JFileChooser fileChooser = new JFileChooser("D:\\");
        fileChooser.setFileSelectionMode(1);
        int returnVal = fileChooser.showOpenDialog(fileChooser);
        if(returnVal == 0) {
            String directoryPath = fileChooser.getSelectedFile().getAbsolutePath();
            return directoryPath;
        } else {
            return null;
        }
    }
}
